﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using Bymed.SpineScan.DataModel;
using Bymed.SpineScan.Repository.Interface;
using Bymed.SpineScan.Service;
using Bymed.SpineScan.Service.Interface;
using Bymed.SpineScan.Service.Shared;
using Bymed.SpineScan.UnitTest.FakeRepository;

namespace Bymed.SpineScan.UnitTest.ServiceTest
{
    [TestFixture]
    public class PatientServiceTest
    {
        private IRepositoryFactory _repositoryFactory;
        private IServiceFactory _serviceFactory;
        private IPatientService _patientService;

        [SetUp]
        protected void Setup()
        {
            _repositoryFactory = new FakeRepositoryFactory();
            _serviceFactory = new ServiceFactory(_repositoryFactory);
            _patientService = _serviceFactory.CreatePatientService();
        }

        //[Test]
        //public void GetPatientCommonNum()
        //{
        //    FakeDataSource.SetPatientsAsCommonPatients();
        //    PatientNumberResult result = _patientService.GetPatientNumber();

        //    Assert.AreEqual(false, result.IsOverflow);

        //    var expected = ConfigFileUtility.GetConfiguredPatientNumberPrefix() + ConfigFileUtility.GetConfiguredPatientNumberDate() + "004";
        //    var actual = result.PatientNumber;

        //    Assert.AreEqual(expected, actual);
        //}

        //[Test]
        //public void GetPatientEmptyNum()
        //{
        //    FakeDataSource.SetPatientsAsEmptyPatients();
        //    PatientNumberResult result = _patientService.GetPatientNumber();

        //    Assert.AreEqual(false, result.IsOverflow);

        //    var expected = ConfigFileUtility.GetConfiguredPatientNumberPrefix() + ConfigFileUtility.GetConfiguredPatientNumberDate() + "001";
        //    var actual = result.PatientNumber;

        //    Assert.AreEqual(expected, actual);
        //}

        //[Test]
        //public void GetPatientOutNum()
        //{
        //    FakeDataSource.SetPatientsAsOutNumberPatients();
        //    PatientNumberResult result = _patientService.GetPatientNumber();

        //    Assert.AreEqual(true, result.IsOverflow);

        //    var expected = ConfigFileUtility.GetConfiguredPatientNumberPrefix() + ConfigFileUtility.GetConfiguredPatientNumberDate() + "0001";
        //    var actual = result.PatientNumber;

        //    Assert.AreEqual(expected, actual);

        //    ConfigFileUtility.ChangeValue(ConfigurationConstant.PatientNumberInitializedSequence, "001");
        //}

        //[Test]
        //public void GetAllTest()
        //{
        //    int count = 3;
        //    var list = _itemService.GetAll();

        //    Assert.AreEqual(count, list.Count);
        //}

        //[Test]
        //public void FormatDueDateDisplayBasedOnNullDueDateTest()
        //{
        //    DateTime? dueDate = null;                       // null
        //    var currentDate = new DateTime(2012, 11, 5);    // Monday
        //    var expected = "Set DueDate";
        //    var actual = InformationFormatter.FormatDueDateDisplay(dueDate, currentDate);

        //    Assert.AreEqual(expected, actual, string.Format("Expected is {0}. Actual is {1}.", expected, actual));
        //}
    }
}
